//559.N叉树的最大深度
//https://leetcode.cn/problems/maximum-depth-of-n-ary-tree/
class Solution {
public:
    int maxDepth(Node* root) {
        if(root == nullptr) return 0;
        queue<Node*> q;
        q.push(root);
        int ret = 0;
        while(!q.empty())
        {
            ++ret;
            int n = q.size();
            while(n--)
            {
                Node* node = q.front(); q.pop();
                for(Node* nd:node->children)
                    if(nd) q.push(nd);
            }
        }
        return ret;
    }
};